package 多线程01_启动线程;

/**
 * @ClassName: 多线程01_启动线程.TestThread01
 * @Author: AllenSun
 * @Date: 2022/3/18 上午12:53
 */
public class TestThread04 {
    public static void main(String[] args) {
        Hero gareen = new Hero("盖伦",616,100);
        Hero teemo = new Hero("提莫",300,130);
        Hero bh = new Hero("赏金猎人",350,165);
        Hero leesin = new Hero("盲僧",455,180);

        //匿名类
        Thread t1 = new Thread() {
            public void run () {
                while (!teemo.isDead()) {
                    gareen.attactHero(teemo);
                }
            }
        };
        t1.start();

        Thread t2 = new Thread() {
            public void run () {
                while (!leesin.isDead()) {
                    bh.attactHero(leesin);
                }
            }
        };
        t2.start();
    }

}
